<?php
class AboutModel extends Model {
	public function __construct() {
		parent::__construct('About');
	}
	
	public function addOne(& $data) {
		return $this->data($data)->add();
	}
	
	public function deleteOne($where) {
		return $this->where($where)->delete();
	}
	
	public function getListByPage($pageSize = 10) {
		import('ORG.Util.Page');
		$pre = C('DB_PREFIX');
		
		$count = $this->count();	
		if(empty($count)) $count = 0;
		$page = new Page($count, $pageSize);
		$pageString = $page->show();
		
		$sql = "select id,content,posttime from {$pre}about where id<=(select id from {$pre}about order by id desc limit {$page->firstRow},1) order by id desc limit {$pageSize}";
		$data = $this->query($sql);
		
		$data['pageString'] = $pageString;
		
		return $data;
	}
	
}